package com.test1230pm;

public class Test05 {
    public static void main(String[] args) {
        // (5)设计一个雇员类和部门类
        // 场景：雇员张三在开发部工作、雇员张三调换部门换成市场部
        // 要求：使用Java语言表示出上述场景

        Section devS = new Section("开发部");
        Servant zhangSan = new Servant("张三", devS);
        zhangSan.work();


        Section marketS = new Section("市场部");
        zhangSan.changeSection(marketS);
        zhangSan.work();
    }
}

class Section {
    private String sec_name;

    public Section(String sec_name) {
        this.sec_name = sec_name;
    }

    public String getSec_name() {
        return sec_name;
    }

    public void setSec_name(String sec_name) {
        this.sec_name = sec_name;
    }
}

class Servant {
    private String name;
    private Section section;

    public Servant(String name, Section section) {
        this.name = name;
        this.section = section;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Section getSection() {
        return section;
    }

    public void setSection(Section section) {
        this.section = section;
    }

    public void work() {
        System.out.println("雇员" + name + "在" + section.getSec_name() + "工作");
    }

    public void changeSection(Section newSection) {
        System.out.println("雇员" + name + "调换部门换成" + newSection.getSec_name());
        this.section = newSection;
    }
}